using System;
using System.Web;

namespace Butterfly.Library.Utilities
{
	public class RefreshModule : IHttpModule
	{
		// IHttpModule::Init
		public void Init(HttpApplication app)
		{
			// Register for pipeline events
			app.AcquireRequestState += new EventHandler( this.OnAcquireRequestState );
		}// func

		// IHttpModule::Dispose
		public void Dispose() 
		{
		}

		#region Private Members
		// Determine if a F5 or back/fwd action is in course
		private void OnAcquireRequestState(object sender, EventArgs evt)
		{
			// Get access to the HTTP context 
			HttpApplication app = (HttpApplication)sender;
			HttpContext ctx = app.Context;

			// Check F5 action
			RefreshAction.Check(ctx);

			return;
		}// func

		#endregion

	}// class
}
